public bool Register(string fname, string lname, string email, string password)
        {
            using (var work = new UnitOfWork())
            {
                if (work.Users.GetAll().FirstOrDefault(x => x.Email == email) != null)
                {
                    Logger.Error(string.Format(Resources.LogRegisterExistingEmail, email));
                    return false;
                }

                var hash = new Md5CryptoService();

                ProfilePhoto photo = (new UsersPhotoService()).GetRandomPhoto();
                var user = new User(fname, lname, email, password, photo)
                {
                    HashPassword = hash.CalculateMd5Hash(password),
                    LocationId = work.Locations.GetAll().First().Id,
                    UserName = email,
                    Birthdate = DateTime.Now
                };

                work.Users.Create(user);
                work.Save();
                List<User> users = work.Users.GetAll().ToList();
                Logger.Info(string.Format(Resources.RegistrationFinished, email));

                return true;
            }
        }
        public bool Register(string fname, string lname, string email, string password)
        {
            using (var work = new UnitOfWork())
            {
                if (work.Users.GetAll().FirstOrDefault(x => x.Email == email) != null)
                {
                    Logger.Error(string.Format(Resources.LogRegisterExistingEmail, email));
                    return(false);
                }

                var hash = new Md5CryptoService();

                ProfilePhoto photo = (new UsersPhotoService()).GetRandomPhoto();
                var          user  = new User(fname, lname, email, password, photo)
                {
                    HashPassword = hash.CalculateMd5Hash(password),
                    LocationId   = work.Locations.GetAll().First().Id,
                    UserName     = email,
                    Birthdate    = DateTime.Now
                };

                work.Users.Create(user);
                work.Save();
                List <User> users = work.Users.GetAll().ToList();
                Logger.Info(string.Format(Resources.RegistrationFinished, email));

                return(true);
            }
        }