         lastKeyboardHeightAfterChange = 0.0
     }
 
-    private func handleKeyboardEvent(ofType type: KeyboardEventType,  userInfo: [AnyHashable:Any]) {
-        guard let beginKeyboardRect = userInfo[UIKeyboardFrameBeginUserInfoKey] as? CGRect,
+    //TextView should be processed in Didxxxxx series of keyboard events (due to incorrect selectedRange value during willxxxxx events)
+    private func shouldProcess(givenKeyboardEvent event: KeyboardEventType, andNotification notification: Notification) -> Bool {
+        guard let userInfo = notification.userInfo,
+            let beginKeyboardRect = userInfo[UIKeyboardFrameBeginUserInfoKey] as? CGRect,
+            let endKeyboardRect = userInfo[UIKeyboardFrameEndUserInfoKey] as? CGRect,
+            let currentFirstResponder = UIResponder.getCurrentFirstResponder() as? UIView else {
+            return false
+        }
+
+        if isKeyboardFrameSame(beginRect: beginKeyboardRect, endRect: endKeyboardRect) {
+            return false
+        }
+
+        let isResponderTextView = currentFirstResponder.isKind(of: UITextView.self)
+
+        switch event {
+        case .WillShow:
+            if !isResponderTextView {
+                return currentKeyboardStateAllowsForProceeding(consideringGivenEvent: event, beginKeyboardRect: beginKeyboardRect, andEndKeyboardRect: endKeyboardRect)
+            } else {
+                return false
+            }
+        case .DidShow:
+            if isResponderTextView {
+                return currentKeyboardStateAllowsForProceeding(consideringGivenEvent: event, beginKeyboardRect: beginKeyboardRect, andEndKeyboardRect: endKeyboardRect)
+            } else {
+                return false
+            }
+        case .WillChange:
+            if !isResponderTextView {
+                return currentKeyboardStateAllowsForProceeding(consideringGivenEvent: event, beginKeyboardRect: beginKeyboardRect, andEndKeyboardRect: endKeyboardRect)
+            } else {
+                return false
+            }
+        case .DidChange:
+            if isResponderTextView {
+                return currentKeyboardStateAllowsForProceeding(consideringGivenEvent: event, beginKeyboardRect: beginKeyboardRect, andEndKeyboardRect: endKeyboardRect)
+            } else {
+                return false
+            }
+        }
+    }
+
+    private func currentKeyboardStateAllowsForProceeding(consideringGivenEvent event: KeyboardEventType, beginKeyboardRect: CGRect, andEndKeyboardRect endKeyboardRect: CGRect) -> Bool {
+        switch event {
+        case .WillShow, .DidShow:
+            if keyboardIsShown || handlingKeyboardChange {
+                return false
+            } else {
+                return true
+            }
+        case .WillChange, .DidChange:
+            if !keyboardIsShown ||
+                handlingKeyboardChange ||
+                isKeyboardBeingHidden(beginRect: beginKeyboardRect, endRect: endKeyboardRect) {
+                return false
+            } else {
+                return true
+            }
+        }
+    }
+
+    private func handleKeyboardEvent(ofType type: KeyboardEventType,  notification: Notification) {
+        guard let userInfo = notification.userInfo,
+            let beginKeyboardRect = userInfo[UIKeyboardFrameBeginUserInfoKey] as? CGRect,
             let endKeyboardRect = userInfo[UIKeyboardFrameEndUserInfoKey] as? CGRect,
             let view = viewController?.view,
             let currentFirstResponderView = UIResponder.getCurrentFirstResponder() as? UIView,

        }
    }

    private func getBottomInsetChangeForKeboardChanged(beginKeyboardRect: CGRect, endKeyboardRect: CGRect) -> CGFloat {
        var keyboardHeightDifference: CGFloat
        let endKbHeight = endKeyboardRect.height

    }

    private enum KeyboardEventType {
        case WillShow
        case DidShow
        case WillChange
        case DidChange
    }
}
