uc-74 Handle database error + addition of fb client helper

RFCR @garthwebb & @lizlux 

Handles database errors on insertion of a user -> fb mapping that already exists.

Also 
* Did some refactoring of controller codes and moved common functionality to a helper.
* Removed duplicated methods (probably caused by multiple merges)